<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<script>
/*	String.prototype.trim=function(){
		return this.replace(/^\s+|\s+$/g,'');	
	};
	
	var str=' abc fd dfd f g ';
	alert('('+str.trim()+')')
*/	
	
//alert(typeof Date)		//function

	function CreatePerson(name,sex){
		//属性:每个对象都各不相同	
		this.name=name;
		this.sex=sex;
	}
	//方法:所有对象都一样的
	CreatePerson.prototype.showName=function(){
		alert(this.name)	
	};
	CreatePerson.prototype.showSex=function(){
		alert(this.sex)	
	};
		
	var p1=new CreatePerson('da','man');
	var p2=new CreatePerson('pansy','woman');
	p1.showName();
	p1.showSex();
	p2.showName();
	p2.showSex();














</script>
</body>
</html>
